# Title: Blank Log Generator
# 
# Description: Simple script for automatically generating logs. Each log will be generated with a creation and last modified date of the current date -1 day for
#              each log created.
# 
#
# Created by: Eric Schewe (eric.schewe@viu.ca)
# Version: 1.1 Beta
# Created date: Sept. 22nd, 2008
#
#
# ToDo: Verfiy the path is correctly formatted. Must have a : and two \'s one of them at the end of the varible
#

$logsToCreate = "C:\Temp\logs" #Full directory path to create the logs in
$totalLogsCreated = "5" #How many logs to create


#Error checking to make sure the varibles are filled in and in the correct format.
if ($logsToCreate -eq "") {
	write-host "Error: logsToCreate needs to be defined. This is the path to where the create logs will be stored."
	exit
}

if ($totalLogsCreated -notlike "[0-9]") {
	write-host "Error: totalLogsCreated needs to be defined or is not a number. This is the amount of logs you want generated."
	exit
}


#Loop for creating $totalLogsCreated worth of logs
for ($i = 0; $i -lt $totalLogsCreated; $i++) {

	fsutil file createNew $logsToCreate\sampleLogFile$i.log 1000 #Creates a 1kb empty file
	set-itemproperty $logsToCreate\sampleLogFile$i.log CreationTime (Get-Date).AddDays(-$i) #Sets the creation date of the file to the current date - $i days
	set-itemproperty $logsToCreate\sampleLogFile$i.log LastWriteTime (Get-Date).AddDays(-$i) #Sets the last modified time of the file to the current date -$i days

}